﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Enterprise.Infrastructure;
using Enterprise.Model.CaiWu;
using Enterprise.Service.Caiwubu;
using Enterprise.Control;
namespace Enterprise.UI.Web.Modules.CaiWuBu
{
    public partial class CwzbList : System.Web.UI.Page
    {
        int typeId = (int)Utility.sink("typeId", Utility.MethodType.Get, 0, 0, Utility.DataType.Int);
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OnStart();
            }
        }

        private void OnStart()
        {
            OnCommand();
            OnBindData();
        }

        private void OnCommand()
        {
            CreateBT.AddButton("back.gif", "返回", "CwTypeIndex.aspx", Utility.PopedomType.List, HeadMenu1);
        }

        private void OnBindData()
        {
            CwZbService zbService = new CwZbService();
            var list = zbService.CwZbList().Where(p => p.ZBTYPEID == typeId);
            GridView1.DataSource = list;
            GridView1.DataBind();
        }

        protected string GetZbTypeList()
        {
            string _html = "<ul>";
            CwTypeService tService = new CwTypeService();
            var list = tService.CwTypeList();
            int i = 1;
            foreach (var var in list)
            {
                _html += string.Format("<li><a href=\"CwZbList.aspx?typeId={1}\"> {2}.  {0}</a>({3})</li>", var.TNAME, var.TYPEID, i, var.TQZ);
                i++;
            }
            return _html+"</ul>";
        }

    }
}